package com.design.found.builder.atguigu.improve;

/**
 * @ProjectName: design
 * @Package: com.design.found.builder.atguigu.improve
 * @ClassName: HouseDirector
 * @Author: shenaiguo
 * @Description: 指挥者
 * @Date: 2020/8/30 0030 17:40
 */
// 步骤4
public class HouseDirector {
    HouseBuilder houseBuilder = null;

    //构造器传入 houseBuilder
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //通过 setter 传入 houseBuilder
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //如何处理建造房子的流程，交给指挥者
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
